package team.ttorder.ttorder.controller;

import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import team.ttorder.ttorder.service.ITableService;

@RestController
public class HomePageController {
	
	@Autowired
	private ITableService tableServiceImpl; 
	
	/**
	 * 前台页面
	 */
	@RequestMapping(value = "/ttdc")
	public ModelAndView customerPage(Model model) {
		model.addAttribute("tables", tableServiceImpl.selectTablesStatus(0));
		return new ModelAndView("ttdc");
	}
	
	@RequestMapping(value = "/table/tableFood/{id}")
	public ModelAndView Order(HttpSession httpSession,@PathVariable int id) {
		httpSession.setAttribute("tableId", id);
		return new ModelAndView("Order");
	}
	
	/**
	 * 后台管理页面
	 */
	@RequestMapping(value = "/tiantiandiancan")
	public ModelAndView homePage() {
		return new ModelAndView("business/indexManage");
	}
	
	/*@RequestMapping(value = "/manageTables")
	public ModelAndView manageTables() {		
		return new ModelAndView("business/table/manageTable");
	}*/
	
	@RequestMapping(value = "/manageOrders")
	public ModelAndView manageOrders() {
		return new ModelAndView("business/orderManage");
	}
	
	@RequestMapping(value = "/loginIndex")
	public ModelAndView login() {
		return new ModelAndView("loginIndex");
	}
	
	@RequestMapping(value = "/registerIndex")
	public ModelAndView register() {
		return new ModelAndView("registerIndex");
	}
	
	@RequestMapping(value = "/checkOut")
	public ModelAndView checkOut() {
		return new ModelAndView("index");
	}
	
}
